﻿using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace EFCore.Migrations
{
    /// <inheritdoc />
    public partial class init : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "CFFK",
                columns: table => new
                {
                    FfkId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    FirstKindId = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    FirstKindName = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    FirstKindSalaryId = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    FirstKindSaleId = table.Column<string>(type: "nvarchar(max)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_CFFK", x => x.FfkId);
                });

            migrationBuilder.CreateTable(
                name: "CFSK",
                columns: table => new
                {
                    FskId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    FirstKindId = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    FirstKindName = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    SecondKindId = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    SecondKindName = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    SecondSalaryId = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    SecondSaleId = table.Column<string>(type: "nvarchar(max)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_CFSK", x => x.FskId);
                });

            migrationBuilder.CreateTable(
                name: "CM",
                columns: table => new
                {
                    MakId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    MajorKindId = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    MajorKindName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    MajorId = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    MajorName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    TestAmount = table.Column<int>(type: "int", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_CM", x => x.MakId);
                });

            migrationBuilder.CreateTable(
                name: "CMK",
                columns: table => new
                {
                    MfkId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    MajorKindId = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    MajorKindName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_CMK", x => x.MfkId);
                });

            migrationBuilder.CreateTable(
                name: "GroupMenu",
                columns: table => new
                {
                    GroupID = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    GroupName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_GroupMenu", x => x.GroupID);
                });

            migrationBuilder.CreateTable(
                name: "Jurisdiction",
                columns: table => new
                {
                    JuriID = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    JurName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    GroupID = table.Column<int>(type: "int", nullable: false),
                    JurAddress = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Jurisdiction", x => x.JuriID);
                });

            migrationBuilder.CreateTable(
                name: "Roles",
                columns: table => new
                {
                    RolesID = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    RolesName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    RolesInstruction = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true),
                    RolesIf = table.Column<bool>(type: "bit", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Roles", x => x.RolesID);
                });

            migrationBuilder.CreateTable(
                name: "RolesJurisdiction",
                columns: table => new
                {
                    RolesJID = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    RolesID = table.Column<int>(type: "int", nullable: false),
                    JuriID = table.Column<int>(type: "int", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_RolesJurisdiction", x => x.RolesJID);
                });

            migrationBuilder.CreateTable(
                name: "User",
                columns: table => new
                {
                    UId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    UName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    UTrueName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    UPassWord = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_User", x => x.UId);
                });

            migrationBuilder.CreateTable(
                name: "UserRoles",
                columns: table => new
                {
                    UserRolesID = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    UserID = table.Column<int>(type: "int", nullable: false),
                    RolesID = table.Column<int>(type: "int", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_UserRoles", x => x.UserRolesID);
                });
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "CFFK");

            migrationBuilder.DropTable(
                name: "CFSK");

            migrationBuilder.DropTable(
                name: "CM");

            migrationBuilder.DropTable(
                name: "CMK");

            migrationBuilder.DropTable(
                name: "GroupMenu");

            migrationBuilder.DropTable(
                name: "Jurisdiction");

            migrationBuilder.DropTable(
                name: "Roles");

            migrationBuilder.DropTable(
                name: "RolesJurisdiction");

            migrationBuilder.DropTable(
                name: "User");

            migrationBuilder.DropTable(
                name: "UserRoles");
        }
    }
}
